/*
fusc.cpp: FuDePAN SVG Creation Library implementation file.
    Copyright (C) 2009  Daniel Gutson, FuDePAN

    This file is part of fusc.

    fusc is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    fusc is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with fusc.  If not, see <http://www.gnu.org/licenses/>.

*/

#include "fusc.h"

const ManipulatorUnsetter<string>
    nofill(&SVG::fill),
    nostroke(&SVG::stroke),
    nofont_family(&SVG::font_family)
;

const ManipulatorUnsetter<size_t>
    nostroke_width(&SVG::stroke_width),
    nofont_size(&SVG::font_size)
;

const ManipulatorUnsetter<TextAnchors>
    notext_anchor(&SVG::text_anchor)
;

extern const ManipulatorUnsetter<FontStyles>
    nofont_style(&SVG::font_style)
;

ostream& operator << (ostream& os, const SVG& svg)
{
    os <<
        "<?xml version=\"1.0\" standalone=\"no\"?>\n"
        "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n"
        "\"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n"
        "<svg width=\"" << (svg.width + 1) << "\" height=\"" << (svg.height + 1) << "\"\n"
        "xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\">\n";

    if (!svg.desc.empty())
        os << "<desc>" << svg.desc << "</desc>\n";

    os << svg.ss.str() << "</svg>";

    return os;
}

